@import "../../themes/ionic.globals.md";

// Material Design Label
// --------------------------------------------------

/// @prop - Text color of the label by an input, select, or datetime
$label-md-text-color:                 #999 !default;

/// @prop - Text color of the stacked/floating label when it is focused
$label-md-text-color-focused:         color($colors-md, primary) !default;

// deprecated
$label-md-margin:                     null !default;

/// @prop - Margin top of the label
$label-md-margin-top:                 $item-md-padding-top !default;

/// @prop - Margin end of the label
$label-md-margin-end:                 ($item-md-padding-end / 2) !default;

/// @prop - Margin bottom of the label
$label-md-margin-bottom:              $item-md-padding-bottom !default;

/// @prop - Margin start of the label
$label-md-margin-start:               0 !default;

// Material Design Default Label
// --------------------------------------------------

.label-md {
  @include deprecated-variable(margin, $label-md-margin) {
    @include margin($label-md-margin-top, $label-md-margin-end, $label-md-margin-bottom, $label-md-margin-start);
  }
}

[text-wrap] .label-md {
  font-size: $item-md-body-text-font-size;
  line-height: $item-md-body-text-line-height;
}

// Material Design Default Label Inside An Input/Select Item
// --------------------------------------------------

.item-input .label-md,
.item-select .label-md,
.item-datetime .label-md {
  color: $label-md-text-color;
}


// Material Design Stacked & Floating Labels
// --------------------------------------------------

.label-md[stacked] {
  font-size: 1.2rem;
}

.label-md[floating] {
  @include transform(translate3d(0, 27px, 0));
  @include transform-origin(start, top);

  transition: transform 150ms ease-in-out;
}

.label-md[stacked],
.label-md[floating] {
  @include margin(null, null, 0, 0);
}

// TODO remove all uses of input-has-focus in v4
// TODO remove all uses of input-has-value in v4
.item-input-has-focus .label-md[stacked],
.input-has-focus .label-md[stacked],
.item-input-has-focus .label-md[floating],
.input-has-focus .label-md[floating] {
  color: $label-md-text-color-focused;
}

.item-input-has-focus .label-md[floating],
.input-has-focus .label-md[floating],
.item-input-has-value .label-md[floating],
.input-has-value .label-md[floating] {
  @include transform(translate3d(0, 0, 0), scale(.8));
}

.item-md.item-label-stacked [item-right], // deprecated
.item-md.item-label-floating [item-right], // deprecated
.item-md.item-label-stacked [item-end],
.item-md.item-label-floating [item-end] {
  @include margin($item-md-padding-media-top - 2, null, $item-md-padding-media-bottom - 2, null);
}


// Generate Material Design Label colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {

  .label-md-#{$color-name},
  .item-input .label-md-#{$color-name},
  .item-select .label-md-#{$color-name},
  .item-datetime .label-md-#{$color-name} {
    color: $color-base;
  }

}
